A detailed transmission electron microscopy study is performed on the
pyramidal inversion domains that appear in highly Mg-doped GaN grown by
metalorganics vapor phase epitaxy or by the high-pressure, high-temperature
method. From a comparison between high resolution images of the inversion
domain boundaries and simulations using different atomic models, we conclude
that both basal and inclined domain boundaries are likely formed of a
monomolecular layer of the definite compound Mg3N2. We show that,
due to their high concentration, the formation of these defects may account
for auto-compensation in Mg-doped GaN. We also show that the local band
bending induced by the polarity inversion due to these defects can be at the
origin of the blue luminescence of highly Mg-doped GaN, always observed when
nanometric pyramidal inversion domains are also present.